<#assign menuId=4>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>大货生产通知单-${Application.systemName!}</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- bootstrap 3.0.2 -->
    <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <!-- font Awesome -->
    <link href="../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <!-- Ionicons -->
    <link href="../css/ionicons.min.css" rel="stylesheet" type="text/css" />
    <!-- Theme style -->
    <link href="../css/AdminLTE.css" rel="stylesheet" type="text/css" />
    <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />

    <link href="../css/myself.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <link href="${domainUrl!}/css/sweet-alert.css" rel="stylesheet" type="text/css" />
	<script src="${domainUrl!}/js/sweet-alert.min.js" type="text/javascript"></script>
	<script src="${domainUrl!}/js/sweetAlert.js" type="text/javascript"></script>

   
    <style type="text/css">
        ul li{
            list-style: none;
            margin-top: 10px;
        }
        .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
			    vertical-align: middle;
			}
        .bold{
        	font-weight: bold;
        	font-size: 14px;
        }
        .pull-left{
            border-left: 6px solid #3882FF;
            padding: 0 5px;
        }
        .marginBottom{
        	margin: 15px 0 10px 0;
        }
        .custormView{
            margin-top: 10px;
        }
        table tr th{
            text-align: center;
        }
        .third{
            width: 33%;;
        }
        .p_center{
            text-align: center !important;
        }
        .center_text{
        	background: #ddd;
        }
        .beizhu{
        	 width: 100%; 
        	 height: auto; 
        	 padding: 5px; 
        	 border: 1px solid #ccc; 
        	 margin: 10px 0;
        }
        .ff{width: 35%}
        .of{width: 15%}
        .one{width: 10%}
        .two{width: 20%}
        .p_left{text-align: left !important;}
        .btn_white{background:white;border: 1px solid #cfd8e3;color: #747e8d;}
        .btn_white:hover{background:white;border: 1px solid #3794ff;color: #56a4ff;}
        .btn{padding: 6px 30px;}
        .top_header{border-bottom: 3px solid black;padding: 10px 0;margin-bottom: 30px; font-size: 26px;}
        td{height: 30px;}
        .foot > .pull-right{margin-left: 10px}
    </style>
</head>
<body class="skin-blue">
<div class="wrapper row-offcanvas row-offcanvas-left" style="width: 70%;margin: 0 auto;">
        <section class="content">
            <div class="row">
                <div class="col-md-12">
                    <div class="box">
                        <div class="clearfix search-div center">
                            <#list productionNoticeList as productionNotice>
                            <form>
                                <div class="p_center top_header clearfix">
                                    <img class="fl" src="../images/logo_black_03.jpg"/>
                                   	 大货生产通知单
                                </div>
                                <div class="clearfix center">
                                    <span class="pull-left marginBottom bold">订单信息</span>
                                </div>
                                <table class="table center table-bordered custormView" >
                                    <tr>
                                        <td  style="border: 0; width: 33%;">
                                           	 订单号:${productionNotice.code!}
                                        </td>
                                        <td style="border: 0; width: 33%;">
                                           	 创建时间:${productionNotice.createAt!}
                                        </td>
                                        <td style="border: 0; width: 33%;">
                                            	截止时间:${(productionNotice.deliveryDate!)?string("yyyy/MM/dd HH:mm")}
                                        </td>
                                    </tr>
                                    <tr>
                                        <td  style="border: 0; width: 33%;">
                                         	  客户名称:${productionNotice.fullname!}
                                        </td>
                                        <td style="border: 0; width: 33%;">
                                         	  客户编号:${productionNotice.customerCode!}
                                        </td>
                                        <td style="border: 0; width: 33%;">
											<div class="style">
	                                               	是否有样衣：
	                                               	<span>${productionNotice.isExists!}</span>
	                                        </div>
                                        </td>
                                    </tr>
                                </table>
                                <div class="clearfix center">
                                	<div class="pull-left marginBottom bold">人员信息</div>
                                </div>
                                <table class="table center table-bordered custormView" >
                                    <td  style="border: 0;">
                                        	销售: 
                                        	<#list productionNotice.participants as participant>
                                        	<#if participant.roleName=="销售">
                                        		${participant.name!}&nbsp;
                                        	</#if>
                                        	</#list>
                                    </td>
                                    <td style="border: 0; width: 33%;">
                                        	设计师:
                                        	<#list productionNotice.participants as participant>
                                        	<#if participant.roleName=="设计师">
                                        		${participant.name!}&nbsp;
                                        	</#if>
                                        	</#list>
                                    </td>
                                    <td style="border: 0; width: 33%;">
                                        	项目经理: 
                                        	<#list productionNotice.participants as participant>
                                        	<#if participant.roleName=="项目经理">
                                        		${participant.name!}&nbsp;
                                        	</#if>
                                        	</#list>
                                    </td>
                                </table>
                                <div class="clearfix center">
                                	<div class="pull-left marginBottom bold">客户需求</div>
                                </div>
                                <table class="table table-bordered center custormView" >
                                    <tr>
                                        <td style="padding: 2em 4em;">${productionNotice.requirement!}</td>
                                    </tr>
                                </table>
                                <div class="clearfix center">
                                	<div class="pull-left marginBottom bold">样衣信息</div>
                                </div>
                                <table class="table text-center center table-bordered order-list">
                                    <tr>
                                        <td colspan="5" class="left-text" style="font-weight: bold;">
                                            <span style="margin-right: 50px;">子订单号：${productionNotice.detailResult.code!}</span>
                                            <span>设计款号:${productionNotice.detailResult.patternNo!}</span>
                                        </td>
                                    </tr>
                                    <td width="50%">
                                        <div class="Design_draft"><img src="${Application.accessFileUrl}${productionNotice.detailResult.mainImage!}" alt="" /></div>
                                    </td>
                                    <td style="vertical-align: top;">
                                        <table class="table table-bordered">
                                            <tr>
                                                <th>颜色</th>
                                                <th>XS</th>
                                                <th>S</th>
                                                <th>M</th>
                                                <th>L</th>
                                                <th>XL</th>
                                                <th>总计</th>
                                            </tr>
                                            <#list productionNotice.detailResult.productionBeforePatternSizes as beforePatternSize>
                                            <tr>
                                                <td>${beforePatternSize.color!}</td>
                                                <td name="size">${beforePatternSize.xsAmount!}</td>
                                                <td name="size">${beforePatternSize.sAmount!}</td>
                                                <td name="size">${beforePatternSize.mAmount!}</td>
                                                <td name="size">${beforePatternSize.lAmount!}</td>
                                                <td name="size">${beforePatternSize.xlAmount!}</td>
                                                <td name="total"></td>
                                            </tr>
                                            </#list>
                                            <tr>
                                                <td colspan="8"  class="right-text">
                                                    <span class="pull-right">共<span id="count"></span>件</span>
                                                </td>
                                            </tr>
                                            
                                        </table>
                                        <table style="width: 100%;">
                                            <td colspan="8">
                                                <table class="table table-bordered">
                                                    <tr>
                                                        <td width="20%">设计款式说明</td>
                                                        <td>
                                                            ${productionNotice.detailResult.description!}
                                                           
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </table>
                                    </td>
                                    <tr>
                                    	<td colspan="2">
                                    		<table class="table table-bordered no-margin">
			                                    <tr>
			                                        <th width="8%">颜色</th>
			                                        <th width="8%">XS</th>
			                                        <th width="8%">S</th>
			                                        <th width="8%">M</th>
			                                        <th width="8%">L</th>
			                                        <th width="8%">XL</th>
			                                        <th width="8%">总计(件)</th>
			                                        <th width="8%">单元(元)</th>
			                                        <th width="8%">总价(元)</th>
			                                        <th width="20%">到货地点</th>
			                                    </tr>
			                                    <#list productionNotice.detailResult.productionPatternSizes as patternSize>
			                                    <tr>
			                                        <td>${patternSize.color!}</td>
			                                        <td name="size1">${patternSize.xsAmount!}</td>
			                                        <td name="size1">${patternSize.sAmount!}</td>
			                                        <td name="size1">${patternSize.mAmount!}</td>
			                                        <td name="size1">${patternSize.lAmount!}</td>
			                                        <td name="size1">${patternSize.xlAmount!}</td>
			                                        <td name="total1"></td>
			                                        <td name="price">${patternSize.price!}</td>
			                                        <td name="allprice"></td>
			                                        <td>${patternSize.arriveAddress!}</td>
			                                    </tr>
			                                    </#list>
												<tr>
													<td colspan="11" class="right-text"><span
														class="pull-right">共<span id="count1"></span>件
													</span></td>
												</tr>
										</table>
                                    	</td>
                                    </tr>
                                </table>
                                <div class="clearfix center">
                                	<div class="pull-left bold" style="margin: 15px 0 10px 0">款式细节明细</div>
                                </div>
                                ${productionNotice.detailResult.detailDescription!}
                                <div class="clearfix center">
                                	<div class="pull-left bold" style="margin: 15px 0 10px 0">面辅料明细</div>
                                </div>
                                ${productionNotice.detailResult.accessoryDetail!}
                                <div class="clearfix center">
                                	<div class="pull-left marginBottom bold">折叠包装方法</div>
                                </div>
                                <table class="table text-center center table-bordered"> 
                                    <tr>
                                        <td width="10%">折叠方法</td>
                                        <td class="text-left" width="40%">${productionNotice.detailResult.foldMethodOther!}</td>
                                        <td width="10%">包装方法</td>
                                        <td class="text-left" width="40%">${productionNotice.detailResult.packageMethodOther!}</td>
                                    </tr>
                                </table>
                                <div class="clearfix center">
                                	<div class="pull-left marginBottom bold">验货</div>
                                </div>
                                <table class="table text-center center table-bordered ">
                                    <tr>
                                        <td width="10%">验货标准</td>
                                        <td class="text-left" width="20%">${productionNotice.detailResult.checkStandardOther!}</td>
                                        <td width="10%">测试要求</td>
                                        <td class="text-left" width="60%" colspan="3">${productionNotice.detailResult.testRequest!}</td>
                                    </tr>
                                    <tr>
                                        <td width="10%">中查</td>
                                        <td class="text-left" width="20%">${productionNotice.detailResult.middleCheck!}</td>
                                        <td width="10%">尾查</td>
                                        <td class="text-left" width="25%">${productionNotice.detailResult.lastCheck!}</td>
                                        <td width="10%">第三方验货</td>
                                        <td class="text-left" width="25%">${productionNotice.detailResult.thirdparty!}</td>
                                    </tr>
                                </table>
                                <div class="clearfix center">
                                	<div class="pull-left marginBottom bold">备注</div>
                                </div>
                                <br />
                                <div class="beizhu center" style="width:96%; margin: 0 0 0 20px">
                                    ${productionNotice.detailResult.memo!}
                                </div>
                                <div class="clearfix center foot" style="margin: 20px 0 20px 20px;"> 
                                	<a href="addProductionNotice?ids=${ids!}&index=${productionNotice_index}" class="btn btn-default">返回修改</a>
                                	<#if productionNoticeList?size==1>
                                    <a href="#" class="btn btn-primary pull-right" id="sure">提交</a>
                                    <#else>
                                    <a href="#" class="btn btn-primary pull-right" id="sure">共${productionNotice_index+1}/${productionNoticeList?size}款，提交</a>
                                    </#if>
                                    <a href="#" class="btn btn-primary pull-right" id="next">下一款</a>
                                	<a href="#" class="btn btn-primary pull-right" id="last">上一款</a>
                                </div>
                                </form>
                            </#list>
                        </div>
                    </div>
                </div>
            </div>
        </section>
</div><!-- ./wrapper -->
<!-- jQuery 2.0.2 -->
<style type="text/css"></style>

<!-- Bootstrap -->
<script src="../js/bootstrap.min.js" type="text/javascript"></script>
<!-- AdminLTE App -->
<script src="../js/AdminLTE/app.js" type="text/javascript"></script>
<!-- AdminLTE for demo purposes -->
<script src="../js/html2canvas.js" type="text/javascript"></script>
<script src="../js/order/production_generate_notice.js" type="text/javascript"></script>
<link href="../css/sweet-alert.css" rel="stylesheet" type="text/css" />
<script src="../js/sweet-alert.min.js" type="text/javascript"></script>

<script type="text/javascript">
	$(function(){
		calculate1();
		calculateTotal1();
		calculate2();
		calculateTotal2();
	});
	function calculate1(){
		var totals = $('td[name="total"]');
		for(var i=0;i<totals.length;i++){
			var inputs = totals.eq(i).parent().find('td[name="size"]');
			var total=0;
			for(var j=0;j<inputs.length;j++){
				var num=inputs.eq(j).html();
	    		if(num&&!isNaN(num)){
	    			total+=parseInt(num);
	    		}
			}
			totals.eq(i).html(total);
		}
	}
	function calculateTotal1(){
		var counts = $('span[id="count"]');
		for(var i=0;i<counts.length;i++){
			var tds = counts.eq(i).parent().parent().parent().parent().find('td[name="total"]');
			var total=0;
			for(var j=0;j<tds.length;j++){
				var num=tds.eq(j).html();
	    		if(num&&!isNaN(num)){
	    			total+=parseInt(num);
	    		}
			}
			counts.eq(i).html(total);
		}
	}
	function calculate2(){
    	var total1s = $('td[name="total1"]');
    	for(var i=0;i<total1s.length;i++){
    		var inputs = total1s.eq(i).parent().find('td[name="size1"]');
    		var price = total1s.eq(i).parent().find('td[name="price"]');
    		var allprice = total1s.eq(i).parent().find('td[name="allprice"]');
    		var total=0;
    		for(var j=0;j<inputs.length;j++){
    			var num=inputs.eq(j).html();
        		if(num&&!isNaN(num)){
        			total+=parseInt(num);
        		}
    		}
    		total1s.eq(i).html(total);
    		if(!isNaN(price.val())&&!isNaN(total1s.eq(i).html())){
    			allprice.html(price.html()*total1s.eq(i).html());
    		}
    	}
    }
    function calculateTotal2(){
    	var counts = $('span[id="count1"]');
    	for(var i=0;i<counts.length;i++){
    		var tds = counts.eq(i).parent().parent().parent().parent().find('td[name="total1"]');
    		var total=0;
    		for(var j=0;j<tds.length;j++){
    			var num=tds.eq(j).html();
        		if(num&&!isNaN(num)){
        			total+=parseInt(num);
        		}
    		}
    		counts.eq(i).html(total);
    	}
    }
    $(function(){
		<#if index??>
		$('form').hide().eq(${index}).show();
		if(${index}==$('form').length)
			$('form').eq(${index}).find('#next').hide();
		<#else>
     	$('form:not(:first)').hide();
     	$('form:first').find('#last').hide();
     	</#if>
     	for(var i=0;i<$('form').length;i++){
			$('form').eq(i).find('#last').click(showLast);
			if(i!=$('form').length-1)
				$('form').eq(i).find('#next').click(showNext);
		}
		$('form').find('#sure').click(generatePdf).removeAttr('href');
    })
    function showLast(){
    	var form=$(this).parents('form').prev();
    	var index=form.index();
    	if(index==0) form.find('#last').hide();
    	form.find('#next').show();
    	form.show();
    	form.next().hide();
    }
	function showNext(){
		var form=$(this).parents('form').next();
    	var index=form.index();
    	if(index==$('form').length-1) form.find('#next').hide();
    	form.find('#next').next().show();
    	form.show();
    	form.prev().hide();
    }
	function generatePdf(){
		confirm('确定生成打样通知单文件？请先确认全部数据已经完整，',function(isConfirm){
			if(isConfirm){
				var url='generateSuccess?id=${id!}&ids=${ids!}';
				exportPdf($('form'),url);
				$('form').hide();
				$(this).parents('form').show();
			}
		});
	}
	$(function(){
		model.ids='${ids!}';
		if(model.ids){
			model.id=model.ids.split(',');
		}
		if(model.id.length==1){
			$('form').find('#next').hide();
			$('form').find('#last').hide();
		}
	})
</script>

</body>
</html>

